//
//  KDEarlyWaringCell.m
//  YuQingXiaoFang
//
//  Created by wangdongdong on 18/6/20.
//  Copyright © 2018年 KDTech. All rights reserved.
//

#import "KDEarlyWaringCell.h"
#import "KDEarlyWaringFrame.h"
#import "KDEarlyWaringModel.h"
@interface KDEarlyWaringCell()
@property (weak, nonatomic)  UILabel *titleLb;
@property (weak,nonatomic) UIImageView *rightArrowImageView;
@end
@implementation KDEarlyWaringCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *cellId =@"KDEarlyWaringCell.h";
    
    
    KDEarlyWaringCell *cell =[tableView dequeueReusableCellWithIdentifier:cellId];
    
    if(cell==nil){
        cell=[[KDEarlyWaringCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellId];
    }
    cell.backgroundColor = BackGroundColor;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    //    cell.similarBtn.layer.cornerRadius = 3.0f;
    //    cell.similarBtn.clipsToBounds = YES;
    //    cell.similarBtn.layer.borderWidth = 0.5;
    //    [cell.reportBtn setImage:[UIImage imageNamed:@"已上报"] forState:UIControlStateDisabled];
    
    
    return cell;
}


-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self setupSubviews];
    }
    
    return self;
}


-(void) setupSubviews{
    
    UILabel *titleLb=[[UILabel alloc] init];
    [self.contentView addSubview:titleLb];
    _titleLb=titleLb;
    
    
    UIImageView *rightArrowImageView=[[UIImageView alloc]init];
    [self.contentView addSubview:rightArrowImageView];
    _rightArrowImageView=rightArrowImageView;
     
     }

-(void)setModelFrame:(KDEarlyWaringFrame *)modelFrame{
    _modelFrame=modelFrame;
    
    [self setupModelData];
    
}

-(void) setupModelData{
    KDEarlyWaringModel *model= self.modelFrame.model;
    
    //标题
    self.titleLb.text=model.title;
    self.titleLb.font=KDNewsCellModelTitleFont;
    self.titleLb.frame=self.modelFrame.titleLabelF;
    
    
    //右箭头
    [self.rightArrowImageView setImage:[UIImage imageNamed:@"rightArrow"]];
    self.rightArrowImageView.frame=self.modelFrame.rightArrowImageF;
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
